﻿@model AP.Framework.Infrastructure.Entities.cms_Product
@Html.ValidationSummary(true)
<script type="text/javascript">
    $(function () {
        $('#photo_upload').uploadify({
            'swf': '@Url.Content("~/Content/themes/uploadify/uploadify.swf")',
            'buttonText': '添加图片...',
            'cancelImg': '@Url.Content("~/Content/themes/uploadify/uploadify-cancel.png")',
            'uploader': '/Admin/Product/Upload',
            'auto': true,
            'onUploadSuccess': function (file, data, response) {
                eval("data=" + data);
                $("#Photo").val(data.msg);
                $("#photoImage").attr("src", data.msg);
            }
        });
        $('#photoLarge_upload').uploadify({
            'swf': '@Url.Content("~/Content/themes/uploadify/uploadify.swf")',
            'buttonText': '添加图片...',
            'cancelImg': '@Url.Content("~/Content/themes/uploadify/uploadify-cancel.png")',
            'uploader': '/Admin/Product/Upload',
            'auto': true,
            'onUploadSuccess': function (file, data, response) {
                eval("data=" + data);
                $("#PhotoLarge").val(data.msg);
                $("#photoLargeImage").attr("src", data.msg);
            }
        });
        $("#photoImage").attr("src", $("#Photo").val());
        $("#photoLargeImage").attr("src", $("#PhotoLarge").val());
    });      
</script>
<div class="control-group">
    <label class="control-label">
        产品分类</label>
    <div class="controls">
        @Html.DropDownListFor(model => model.ProductCategoryId, (IEnumerable<SelectListItem>)ViewBag.proCategoryList, new { @style = "width:100px;" })
        @Html.ValidationMessageFor(model => model.ProductCategoryId)
    </div>
</div>
<div class="control-group">
    <label class="control-label">
        产品名称</label>
    <div class="controls">
        @Html.TextBoxFor(model => model.Name, new { @placeholder = "产品名称" })
        @Html.ValidationMessageFor(model => model.Name)
    </div>
</div>
<div class="control-group">
    <label class="control-label">
        产品图片</label>
    <div class="controls">
        @Html.TextBoxFor(model => model.Photo, new { @placeholder = "产品图片" })
        <input type="file" name="photo_upload" id="photo_upload" />
        <img id="photoImage" alt="图片缩放显示" src="" style="" />
        @Html.ValidationMessageFor(model => model.Photo)
    </div>
</div>
<div class="control-group">
    <label class="control-label">
        产品大图</label>
    <div class="controls">
        @Html.TextBoxFor(model => model.PhotoLarge, new { @placeholder = "产品大图" })
        <input type="file" name="photoLarge_upload" id="photoLarge_upload" />
        <img id="photoLargeImage" alt="图片缩放显示" src="" style="" />
        @Html.ValidationMessageFor(model => model.PhotoLarge)
    </div>
</div>
<div class="control-group">
    <label class="control-label">
        描述</label>
    <div class="controls">
        @Html.TextAreaFor(model => model.Description, new { @placeholder = "描述", @style = "width:80%;height:200px;" })
        @Html.ValidationMessageFor(model => model.Description)
    </div>
</div>
<div class="control-group">
    <label class="control-label">
        排序号</label>
    <div class="controls">
        @Html.TextBoxFor(model => model.Sequence, new { @placeholder = "排序号" })
        @Html.ValidationMessageFor(model => model.Sequence)
    </div>
</div>
<div class="control-group">
    <label class="control-label">
        是否隐藏/锁定</label>
    <div class="controls">
        <label class="checkbox">
            @Html.CheckBoxFor(model => model.IsDisable)
            @Html.ValidationMessageFor(model => model.IsDisable)
        </label>
    </div>
</div>
<div class="control-group">
    <div class="controls">
        <button type="submit" class="btn">
            保 存</button>
    </div>
</div>
